<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>some()，every()</title>
</head>
<body>
    <script>
        //some使用方法
        //直接使用some
        var arr=[1,2,3,4,5];
        var newArr = arr.some(function(elem){
            return elem>=3
        })
        console.log(newArr)
        //间接some的用法 
        var arr1=[1,2,3,4,5];
        function some(){
            var br=false;
        for(var i=0;i<arr1.length;i++){
            if(arr1[i]>3){
                br= true;
            }
        }console.log(br); 
        }
        some();
        //直接使用every
        var arr=[1,2,3,4,5];
        var newArr2=arr.every(function(elem){
            return elem>=3;
        })
        console.log(newArr2)
        // every的作用
        function every(){
            var br=true;
        for(var i=0;i<arr1.length;i++){
            if(arr1[i]>3){
                br= false;
            }
            
        }console.log(br); 
        }
        every();


    </script>
</body>
</html>